<?PHP
/* $Id: stats.php 7 2009-03-24 20:25:52Z ronan $ */

session_start();
//getting the user's access to see if they are allowed
include("includes/paxsql.php");
$result = mysql_query("SELECT userid, name FROM userinfo");
while($row = mysql_fetch_array($result))
	$name[$row['userid']] = $row['name'];
mysql_close();

include 'includes/database.php';
//include 'includes/library.php';

if($access == 5)
{

/*if($_POST['submitted'] == 1)
	mysql_query("DELETE FROM qControl WHERE time > '".(time()-(30*24*60*60))."'");
 */
echo("
<html>
<head>
<link rel='stylesheet' type='text/css' href='main.css'>
<title>snowflake</title>");

//include('includes/javascript.php');
echo("
</head>

<body>

<div id='isAltWin' style='display: none;'></div>
<div id='flagWin' style='display: none;'></div>

<div id='wrapper'>

	<div id='header'><a href='/'>snowflake</a></div>

	<div id='navi'>");

include('includes/navi.php');
echo("</div>

	<div id='main'>
		<h1>Action Log</h1>
		<hr>
		<br />");
		/*<form name = 'clear' action = 'control.php' method = 'post'>
		<input type = 'hidden' value = '1' name = 'submitted' />
		<input type = 'submit' value = 'Cleanup' />
		</form>*/
	echo("
		<br />
		<br />");

$result = mysql_query("SELECT * FROM qControl ORDER BY time DESC") or die(mysql_error());
while($row = mysql_fetch_array($result))
{
	$action = str_replace("c34c",'"',$row['action']);
	$action = str_replace("c39c","'",$action);
	echo($name[$row['uid']]." ".$action." <br />DateTime: ".date("d/m/Y | H:i:s",($row['time'] - (2*60*60)))." <br /><br />");
}
echo("
	</div>
	
</div>

</body>

</html>");
}
else
{
	header("Location: http://".$_SERVER['HTTP_HOST']."/index.php");
}
mysql_close();
?>
